/*
 * Copyright (C) 2021 Fastjrun, Inc. All Rights Reserved.
 */
package com.fastjrun.share.demo.config;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@MapperScan({"com.fastjrun.share.demo.dao","com.fastjrun.share.demo.service.impl"})
@ComponentScan("com.fastjrun.share.demo")
@Configuration
public class AppConfig {
    Logger logger = LoggerFactory.getLogger(getClass());

    @Bean
    @ConditionalOnMissingBean
    public PasswordEncoder passwordEncoder() {
        logger.info("I am in AppConfig");
        // 明文+随机盐值》加密存储
        return new BCryptPasswordEncoder();
    }

}
